package main
import (
    "fmt"
    "io/ioutil"
    "os"
)

/*
1: create a chan array ( include 10 chan )
2: then go count() , before " ch <-1 " ,this count will be blocked ,so every chan in the array will print  id +": Before Counting"
3: after that , push 1 to every channel , blocked continue...
4: range chs , this operate will stop every chan's block status ,so every chan will print id+" :After Counting"
*/

func Count(ch chan int ,id int){
    fmt.Println(id,": Before Counting")
    ch <- 1
    fmt.Println(id,": After Counting")
}

func main() {
    chs:=[10]chan  int{}
    for i:=0;i<10;i++{
        chs[i] = make(chan int)
        go Count(chs[i],i)
    }

    for _,ch := range chs{
        <- ch
    }

    input,_ := ioutil.ReadAll(os.Stdin)
    fmt.Println(input)
}
